Srated = 10e3;
Pbase = Srated;
Prated = 7.5e3;
Qrated = 6.6144e3;
Qrated = sqrt(Srated^2-Prated^2);
v0_rms = 220;
v0_peak = sqrt(2)*220;
Ubase = 220*sqrt(2);
Wbase = 100*pi;
Ibase = 2/3*Pbase/Ubase;
Zbase = Ubase/Ibase;
Lbase = Zbase/Wbase;
Cbase = 1/Zbase/Wbase;
Vdc = 800;

La = 1.5*0.2082*Lbase;
Lg = 5.24e-2*Lbase;
Cf = 2*8.79e-2*Cbase;

delta_omegag_max = pi;
delta_vmax = 0.05*v0_rms;
eta = 3*delta_omegag_max*(v0_rms+delta_vmax)^2/Prated;
mu = 2*eta*Qrated/(3*((2*(v0_rms+delta_vmax)^2-v0_rms^2)^2 - v0_rms^4));

Ts = 1/20000;
Tctrl = Ts/2;

%% NPC
sw = [0,0,0; ...
    1,0,0;...
    1,1,0;...
    0,1,0;...
    0,1,1;...
    0,0,1;...
    1,0,1;...
    1,1,1];
sw1 = [0,0,0;...
    1,1,1;...
    2,2,2;...
    2,1,1;...
    1,0,0;...
    2,1,0;...
    2,0,1;...
    2,0,0];
sw2 = [0,0,0;...
    1,1,1;...
    2,2,2;...
    2,2,1;...
    1,1,0;...
    1,2,0;...
    2,1,0;...
    2,2,0];
sw3 = [0,0,0;...
    1,1,1;...
    2,2,2;...
    1,2,1;...
    0,1,0;...
    0,2,1;...
    1,2,0;...
    0,2,0];
sw4 = [0,0,0;...
    1,1,1;...
    2,2,2;...
    1,2,2;...
    0,1,1;...
    0,1,2;...
    0,2,1;...
    0,2,2];
sw5 = [0,0,0;...
    1,1,1;...
    2,2,2;...
    1,1,2;...
    0,0,1;...
    1,0,2;...
    0,1,2;...
    0,0,2];
sw6 = [0,0,0;...
    1,1,1;...
    2,2,2;...
    2,1,2;...
    1,0,1;...
    2,0,1;...
    1,0,2;...
    2,0,2];

pswitch = [1,1,0,0];
oswitch = [0,1,1,0];
nswitch = [0,0,1,1];


%% 


